home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 001-100 / 001-025 / 024 / csh / main.c < prev    next >
C/C++ Source or Header  |  1995-03-17  |  763b  |  51 lines

  1.  
  2. /*
  3.  * MAIN.C
  4.  *
  5.  * Matthew Dillon, 28 Apr 1986
  6.  *
  7.  * el main routine.
  8.  */
  9.  
  10. #include "shell.h"
  11.  
  12. char Inline[256];
  13.  
  14. main(argc, argv)
  15. char *argv[];
  16. {
  17.    char *prompt;
  18.    int i;
  19.  
  20.    init_vars();
  21.    init();
  22.    for (i = 1; i < argc; ++i) {
  23.       strcpy (Inline, "source ");
  24.       strcat (Inline, argv[i]);
  25.       do_source (Inline, 0);
  26.    }
  27.    for (;;) {
  28.       if ((prompt = get_var (LEVEL_SET, V_PROMPT)) == NULL)
  29.          prompt = "echo -n \"% \"";
  30.       ++H_stack;
  31.       exec_command (prompt);
  32.       --H_stack;
  33.       fflush (stdout);
  34.       if (gets (Inline) == NULL)
  35.          exit (0);
  36.       if (*Inline)
  37.          exec_command (Inline);
  38.    }
  39. }
  40.  
  41. init()
  42. {
  43. }
  44.  
  45. init_vars()
  46. {
  47.    set_var (LEVEL_SET, V_PROMPT, "echo -n \"% \"");
  48.    set_var (LEVEL_SET, V_HIST,   "20");
  49. }
  50.  
  51.